<?php
include_once("locale/langmeta.php");
$country='';

if(isset($_POST["lang"]))
{
	//include_once("admin/includes/util.php");
//	require_once("model/FIN_categoryBean.class.php");
	if($_POST["lang"] == "change"){
		if($_SESSION["LC_ALL"] == "vi")
			$_SESSION["LC_ALL"] = "en";	
		else
			$_SESSION["LC_ALL"] = "vi"	;
	}
	//$page = FIN_categoryBean::get_url_lang($db,$_POST["url"],$_SESSION["LC_ALL"]);
	//$type = array('ID' => -1, 							  'message' => $page->cat_url);
	//echo array2json($type);	
}
if(isset($_SESSION["LC_ALL"]))
{
	$locale = $_SESSION["LC_ALL"];
	if(isset($_SESSION["LC_COUNTRY"]))
	$country = $_SESSION["LC_COUNTRY"];
}
else
{
	$locale = DEFAULT_LANG;
}

if (isset($_POST["locale"])) 
{
	$locale = $_POST["locale"];
	$country = $_POST["txtcountry"];
}

$_SESSION["LC_ALL"] = $locale;
if(isset($country))
$_SESSION["LC_COUNTRY"] = $country;

if(!isset($langmeta[$locale]) &&
   !isset($langmeta[DEFAULT_LANG]))
{
	echo "Language not found. Please ask admistrator for more information.";
	die;
}
?>

